import * as request from "@/utils/request"

const API_PREFIX = "/User"

/**
 * 新增用户
 */
export function userCreate(params: UserCreateRequest) {
  return request.post<boolean>({
    url: API_PREFIX + "/Create",
    data: params
  })
}

/**
 * 删除用户
 */
export function userDelete(params: DeleteRequest) {
  return request.get<boolean>({
    url: API_PREFIX + "/Delete",
    params
  })
}

/**
 * 编辑用户
 */
export function userEdit(params: UserEditRequest) {
  return request.post<boolean>({
    url: API_PREFIX + "/Edit",
    data: params
  })
}

/**
 * 根据 id 获取用户信息
 */
export function getUserById(params: GetUserByIdRequest) {
  return request.get<UserResponse>({
    url: API_PREFIX + "/Get",
    params
  })
}

/**
 * 获取当前用户信息
 */
export function getCurrentUser() {
  return request.get<UserResponse>({
    url: API_PREFIX + "/GetCurrentUser"
  })
}

/**
 * 分页查询用户
 */
export function getUserByPage(params: UserQueryRequest) {
  return request.get<PageResponse<UserResponse>>({
    url: API_PREFIX + "/GetPage",
    params
  })
}

/**
 * 设置用户状态
 */
export function userSetStatus(params: UserSetStatusRequest) {
  return request.post<boolean>({
    url: API_PREFIX + "/SetStatus",
    data: params
  })
}
